package mediator;

import java.util.ArrayList;
import java.util.List;

public class ChatRoom {


    String name;
    List<User> users;

    public ChatRoom(String name) {
        this.name = name;
        users = new ArrayList<>();
    }

    public String getName() {
        return name;
    }

    public void addUser(User user) {
        users.add(user);
    }

    public void deleteUser(User user) {
        users.remove(user);
    }

    public void sendMessage(String message) {
        for (User user : users) {
            user.receiveMessage(message);
        }
    }
}
